<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Help\Widget;

use Think\Action;

/**
 * Class OtherWorksWidget  其他作品
 * @package Help\Widget
 * @author:xjw129xjt xjt@ourstu.com
 */
class OtherWorksWidget extends Action
{

    /* 显示指定分类的同级分类或子分类列表 */
    public function lists($uid)
    {

        $uid = intval($uid) ? intval($uid) : is_login();
        $works = D('Help')->getList(array('uid' => $uid, 'status' => 1));
        $ids = getSubByKey($works, 'id');
        $list_my = D('HelpWorks')->getWorkList(array('help_id' => array('in', $ids)));
        $list_attend = D('HelpAttend')->getAttendByUid($uid);
        $list = array_merge($list_my, $list_attend);
        shuffle($list);
        $this->assign('list', $list);
        $this->display('Widget/other');

    }


}
